home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qscrollbar.h.z / qscrollbar.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.1 KB  |  130 lines

  1. /****************************************************************************
  2. ** $Id: qscrollbar.h,v 2.7 1998/07/03 00:09:52 hanord Exp $
  3. **
  4. ** Definition of QScrollBar class
  5. **
  6. ** Created : 940427
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QSCROLLBAR_H
  25. #define QSCROLLBAR_H
  26.  
  27. #ifndef QT_H
  28. #include "qwidget.h"
  29. #include "qrangecontrol.h"
  30. #include "qdrawutil.h"
  31. #endif // QT_H
  32.  
  33. class QScrollBar : public QWidget, public QRangeControl
  34. {
  35.     Q_OBJECT
  36. public:
  37.     enum Orientation { Horizontal, Vertical };
  38.  
  39.     QScrollBar( QWidget *parent=0, const char *name=0 );
  40.     QScrollBar( Orientation, QWidget *parent=0, const char *name=0 );
  41.     QScrollBar( int minValue, int maxValue, int LineStep, int PageStep,
  42.         int value, Orientation,
  43.         QWidget *parent=0, const char *name=0 );
  44.  
  45.     void    setOrientation( Orientation );
  46.     Orientation orientation() const;
  47.     void    setTracking( bool enable );
  48.     bool    tracking() const;
  49.  
  50.     bool    draggingSlider() const;
  51.  
  52.     void    setPalette( const QPalette & );
  53.     QSize    sizeHint() const;
  54.  
  55. signals:
  56.     void    valueChanged( int value );
  57.     void    sliderPressed();
  58.     void    sliderMoved( int value );
  59.     void    sliderReleased();
  60.     void    nextLine();
  61.     void    prevLine();
  62.     void    nextPage();
  63.     void    prevPage();
  64.  
  65. protected:
  66.     void    timerEvent( QTimerEvent * );
  67.     void    keyPressEvent( QKeyEvent * );
  68.     void    resizeEvent( QResizeEvent * );
  69.     void    paintEvent( QPaintEvent * );
  70.  
  71.     void    mousePressEvent( QMouseEvent * );
  72.     void    mouseReleaseEvent( QMouseEvent * );
  73.     void    mouseMoveEvent( QMouseEvent * );
  74.  
  75.     void    valueChange();
  76.     void    stepChange();
  77.     void    rangeChange();
  78.  
  79.     int        sliderStart() const;
  80.     QRect    sliderRect() const;
  81.  
  82. private:
  83.     void    init();
  84.     void    positionSliderFromValue();
  85.     int        calculateValueFromSlider() const;
  86.  
  87.     uint    pressedControl     : 8;
  88.     uint    track         : 1;
  89.     uint    clickedAt     : 1;
  90.     uint    orient         : 1;
  91.     uint    thresholdReached : 1;
  92.     uint    isTiming     : 1;
  93.  
  94.     int        slidePrevVal;
  95.     QCOORD    sliderPos;
  96.     QCOORD    clickOffset;
  97.  
  98. private:    // Disabled copy constructor and operator=
  99.     QScrollBar( const QScrollBar & );
  100.     QScrollBar &operator=( const QScrollBar & );
  101. };
  102.  
  103.  
  104. inline void QScrollBar::setTracking( bool t )
  105. {
  106.     track = t;
  107. }
  108.  
  109. inline bool QScrollBar::tracking() const
  110. {
  111.     return track;
  112. }
  113.  
  114. inline QScrollBar::Orientation QScrollBar::orientation() const
  115. {
  116.     return (Orientation)orient;
  117. }
  118.  
  119. inline int QScrollBar::sliderStart() const
  120. {
  121.     return sliderPos;
  122. }
  123.  
  124.  
  125. void qDrawArrow( QPainter *, ArrowType type, GUIStyle style, bool down,
  126.          int x, int y, int w, int h, const QColorGroup & );
  127.  
  128.  
  129. #endif // QSCROLLBAR_H
  130.